package com.example.courier.mapper;

import com.example.courier.entity.Location;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author qwert
 * @version 1.0.0
 * @create 2025/9/6 10:41
 **/
@Mapper
public interface LocationMapper {

    @Insert("""
INSERT INTO ha_location (location_id, name, detailed_address, type, note, latitude, longitude, is_pickup_point,
                         contact_phone, business_hours, status, create_time, update_time, operator_id, is_delete)
VALUES (#{locationId}, #{name}, #{detailedAddress}, #{type}, #{note}, #{latitude}, #{longitude}, #{isPickupPoint},
 #{contactPhone}, #{businessHours}, #{status}, now(), now(), null, 0);
""")
    void saveLocation(Location location);

    @Select("""
select * from ha_location where location_id = #{locationId};
""")
    Location queryLocationById(String locationId);

    @Select("""
select * from ha_location;
""")
    List<Location> queryLocationList();
}
